<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <head th:include="common::commonHeader"></head>
    <link rel="stylesheet" th:href="@{/css/main.css}">
    <style>
        .tree li {
            list-style-type: none;
            cursor:pointer;
        }
        table tbody tr:nth-child(odd){background:#F4F4F4;}
        table tbody td:nth-child(even){color:#C00;}
    </style>
</head>

<body>

<div th:replace="main-common::main-body-header"></div>

<div class="container-fluid">
    <div class="row">
        <div th:replace="main-common::main-body-ul"></div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="glyphicon glyphicon-th"></i> 数据列表</h3>
                </div>
                <div class="panel-body">
                    <form th:action="@{/main/mainuser}" method="post" class="form-inline" role="form" style="float:left;">
                        <div class="form-group has-feedback">
                            <div class="input-group">
                                <div class="input-group-addon">查询条件</div>
                                <input name="keyword" class="form-control has-success" type="text" placeholder="请输入查询条件">
                            </div>
                        </div>
                        <button type="submit" class="btn btn-warning">
                            <i class="glyphicon glyphicon-search"></i>
                            查询
                        </button>
                    </form>
                    <button type="button" class="btn btn-danger" style="float:right;margin-left:10px;"><i class=" glyphicon glyphicon-remove"></i> 删除</button>
                    <a th:href="@{/main/user/addUser}" class="btn btn-primary" style="float:right;" onclick="window.location.href='add.html'">
                        <i class="glyphicon glyphicon-plus"></i>
                        新增
                    </a>
                    <br>
                    <hr style="clear:both;">
                    <div class="table-responsive">
                        <table class="table  table-bordered">
                            <thead>
                            <tr >
                                <th width="30">#</th>
                                <th width="30"><input type="checkbox"></th>
                                <th>账号</th>
                                <th>名称</th>
                                <th>邮箱地址</th>
                                <th width="100">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                                <tr th:if="${pageInfo.list}!=null" th:each="admin1,loopStatus:${pageInfo.list}">
                                    <td th:text="${loopStatus.count}"></td>
                                    <td><input type="checkbox"></td>
                                    <td th:text="${admin1.loginAcct}">Lorem</td>
                                    <td th:text="${admin1.username}">ipsum</td>
                                    <td th:text="${admin1.email}">dolor</td>
                                    <td>
                                        <a th:href="@{/assign/toAssign(adminId=${admin1.id},keyword=${keyword1},pageNum=${pageInfo.pageNum})}" class="btn btn-success btn-xs"><i class=" glyphicon glyphicon-check"></i></a>
                                        <a th:href="@{/main/user/updateUser(adminId=${admin1.id},keyword=${keyword1},pageNum=${pageInfo.pageNum})}" type="button" class="btn btn-primary btn-xs"><i class=" glyphicon glyphicon-pencil"></i></a>
                                        <a th:href="@{/main/remove(adminId=${admin1.id},keyword=${keyword1},pageNum=${pageInfo.pageNum})}" class="btn btn-danger btn-xs"><i class=" glyphicon glyphicon-remove"></i></a>
                                    </td>
                                </tr>

                                <tr th:if="${pageInfo}==null">
                                    <td colspan="6" align="center">抱歉！没有查询到数据</td>
                                </tr>

                            </tbody>
                            <tfoot>
                                <tr >
                                    <td colspan="6" align="center">
                                        <ul class="pagination">
                                            <li th:class="${pageInfo.isFirstPage}?'disabled':''"><a th:href="@{/main/mainuser(pageNum=${pageInfo.prePage},keyword=${keyword1})}">上一页</a></li>

                                            <li th:each="arr:${pageInfo.navigatepageNums}" th:class="${pageInfo.pageNum}==${arr}?'active':''">
                                                <a th:href="@{/main/mainuser(pageNum=${arr},keyword=${keyword1})}" th:text="${arr}"></a>
                                            </li>

                                            <li th:class="${pageInfo.isLastPage}?'disabled':''">
                                                <a th:href="@{/main/mainuser(pageNum=${pageInfo.nextPage},keyword=${keyword1})}">
                                                    下一页
                                                </a>
                                            </li>
                                            <li style="margin-left: 16px;line-height: 32px;">共【[[${pageInfo.pages}]]】页</li>
                                        </ul>
                                    </td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div th:replace="common::commonFooter"></div>
<script th:src="@{/script/docs.min.js}"></script>
<script type="text/javascript">
    $(function () {
        $(".list-group-item").click(function(){
            if ( $(this).find("ul") ) {
                $(this).toggleClass("tree-closed");
                if ( $(this).hasClass("tree-closed") ) {
                    $("ul", this).hide("fast");
                } else {
                    $("ul", this).show("fast");
                }
            }
        });
    });
    // $("tbody .btn-success").click(function(){
    //     window.location.href = "assignRole.html";
    // });
    // $("tbody .btn-primary").click(function(){
    //     window.location.href = "edit.html";
    // });
</script>
</body>
</html>
